<template>
  <div class="resume">
    <div class="banner"></div>

    <div class="profile">
      <div class="profile-header">
        <div class="profile-header__title">
          <h1>招聘信息</h1>
        </div>

        <div class="profile-header__add-button">
<!--          <router-link to="/resumeAdd">-->
            <el-button plain round icon="el-icon-edit" @click="dialogVisible = true">新增</el-button>
<!--          </router-link>-->
        </div>

      </div>

      <div class="resumeForm">
        <el-table
            :data="tableData"
            stripe
            style="width: 100%">
          <el-table-column
              prop="recruitId"
              align="center"
              label="编号">
          </el-table-column>
          <el-table-column
              prop="post"
              label="职位">
          </el-table-column>
          <el-table-column
              prop="position"
              label="岗位类别">
          </el-table-column>
          <el-table-column
              prop="workplace"
              label="工作地点">
          </el-table-column>
        </el-table>
      </div>

      <el-dialog title="新增招聘页面" :visible.sync="dialogVisible" width="50%">
        <el-form ref="form"  label-width="150px">
          <el-form-item label="公司id">
            <el-input v-model="eid"></el-input>
          </el-form-item>
          <el-form-item label="年龄要求">
            <el-input v-model="ageRequire"></el-input>
          </el-form-item>
          <el-form-item label="联系人">
            <el-input v-model="contacts"></el-input>
          </el-form-item>
          <el-form-item label="学历要求">
            <el-input v-model="educationRequire"></el-input>
          </el-form-item>
          <el-form-item label="邮箱">
            <el-input v-model="email"></el-input>
          </el-form-item>
          <el-form-item label="工作经验要求">
            <el-input v-model="experienceRequire"></el-input>
          </el-form-item>
          <el-form-item label="性别要求">
            <el-radio v-model="genderRequire" :label=0 >男</el-radio>
            <el-radio v-model="genderRequire" :label=1 >女</el-radio>
          </el-form-item>
          <el-form-item label="专业要求">
            <el-input v-model="majorRequire"></el-input>
          </el-form-item>
          <el-form-item label="招聘人数">
            <el-input type="number" v-model.number="numbersLimit"></el-input>
          </el-form-item>
          <el-form-item label="岗位类别">
            <el-input v-model="position"></el-input>
          </el-form-item>
          <el-form-item label="职位">
            <el-input v-model="post"></el-input>
          </el-form-item>
          <el-form-item label="工资">
            <el-input v-model="salary"></el-input>
          </el-form-item>
          <el-form-item label="联系电话">
            <el-input v-model="telephone"></el-input>
          </el-form-item>
          <el-form-item label="工作地点">
            <el-input v-model="workplace"></el-input>
          </el-form-item>
          <el-button type="primary" @click="addRecruit">提交</el-button>
          <el-button @click="dialogVisible=false">取消</el-button>
        </el-form>
      </el-dialog>

    </div>
  </div>
</template>
<script>

export default {
  name: "resume",
  data() {
    return {
      resumeDetail: {},
      tableData: [{
        recruitId: "",
        position: "",
        post: "",
        workplace: ""
      }],
      dialogVisible:false,
        eid:1,
        ageRequire:"",
        contacts:"",
        educationRequire:"",
        email:"",
        experienceRequire:"",
        genderRequire:"",
        majorRequire:"",
        position:"",
        post:"",
        salary:"",
        telephone:"",
        numbersLimit:"",
        workplace:"",
    };
  },
  mounted() {
    this.getMyResume()
  },
  methods: {
    async getMyResume() {
      try {
        await this.$store.dispatch('getReqRecruits')
        this.tableData = this.$store.state.enterprise.recruitsList
      } catch (e) {
        console.log(e)
      }
    },
    async addRecruit(){
      try {
        const {eid, ageRequire,contacts, educationRequire, email,experienceRequire,genderRequire,majorRequire,position,post,salary,telephone,numbersLimit,workplace} = this;
        await this.$store.dispatch('getRecruit', {eid, ageRequire,contacts, educationRequire, email,experienceRequire,genderRequire,majorRequire,position,post,salary,telephone,numbersLimit,workplace})
        this.dialogVisible = false
        this.$notify.success({
          message: '成功新增招聘信息!'
        })
      } catch (error) {
        alert(error.message)
      }
    },
  },
};
</script>

<style lang="less" scoped>
h1 {
  color: #fff;
  height: 59px;
  line-height: 59px;
  font-size: 30px;
  font-weight: 800;
}

.profile-header__add-button{

}

.span {
  font-size: 16px;
}

.banner {
  // width: 1200px;
  background-image: url("//lf3-cdn-tos.bytescm.com/obj/ttfe/ATSX/my_application_banner_1577084307047.jpg");
  background-size: 100% 100%;
  height: 300px;
  background-repeat: no-repeat;
}

.profile {
  width: 900px;
  margin: auto;
  margin-top: -200px;

  &-header {
    color: #fff;
    display: flex;
    justify-content: space-between;

    align-items: center;
  }

  .resumeForm {
    margin-top: 30px;
    background: #fff;
    box-shadow: 0px 9px 20px 0px #c2c1c180;
    border-radius: 4px;
    padding: 30px;

    .resumeViewSection {
      min-height: 300px;
      margin-bottom: 30px;

      &__title {
        position: relative;
        height: 32px;
        margin-bottom: 38px;
        font-size: 20px;
        font-weight: 800;
        line-height: 1.6;
        color: #1f2329;
      }

      .resumeViewForm {
        margin-bottom: 30px;
      }

      .resumeViewItem {
        float: left;
        width: 50%;
        margin-bottom: 20px;
        min-height: 50px;

        &__resumeAttachment {
          display: flex;
          padding: 10px;
          background-color: #3370ff;
          align-items: center;

          time {
            //color: @regular-text-color;
            //font-size: @font-size-base;
          }

          .fileIcon {
            margin-right: 10px;
            width: 50px;
            height: 50px;
          }

          .download-link {
            margin-left: auto;

            .el-icon-download {
              //font-size: @font-size-large;
              border-radius: 50%;
              //border: 1px solid @border-base-color;
              padding: 4px;
            }

            &:hover {
              //color: @main-color;
            }
          }
        }

        &__content.is-link {
          //color: @main-color;
          cursor: pointer;
        }

        &__label {
          margin-bottom: 4px;
          height: 24px;
          font-size: 14px;
          font-weight: 500;
          line-height: 1.71;
          color: #1f2329;
          opacity: .45;
        }

        &__content {
          word-wrap: break-word;
          font-size: 16px;
          line-height: 1.75;
          color: #1f2329;
        }

        &__content-link {
          //color: @main-color;
        }

        &-desc {
          overflow: hidden;
          width: 70%;
          white-space: pre-line;
        }
      }
    }
  }
}
</style>